//导入api函数
import { getSearchData } from "@/api"
export default {
    data() {
        return {
            wordList: []
        }
    },
    async mounted() {
        let res = await getSearchData()
        // console.log(res)
        //加工返回的数据
        res.forEach(item => {
            item.hit = ((item.user / item.count) * 100).toFixed(2)
            this.wordList.push(item)
        })
        //按照点击率排名
        this.wordList.sort((a,b)=>{
            return b.hit - a.hit
        })
        //排序下标
        this.wordList.forEach((item,key) => {
            item.no = key + 1
        })
    }
}